import React from 'react';
import { AppRegistry,Platform } from 'react-native'; // 各种包一定要注意导入

console.disableYellowBox = true;
console.warn("YellowBox is disabled.");

import { NativeModules } from 'react-native';
import { StackNavigator } from 'react-navigation';

global.ReadAppConstant = {};

const Dimensions = require('Dimensions');
const { width, height } = Dimensions.get('window');

global.ScreenWidth = width;
global.ScreenHeight = height;


global.ScreenSizeMod = 1;  // 1 最小  2 中  3 大

if (global.ScreenWidth == 375) {
  global.ScreenSizeMod = 2;
}

const X_WIDTH = 375;
const X_HEIGHT = 812;
global.isIphoneX = Platform.OS === 'ios' &&
  ((global.ScreenHeight === X_HEIGHT && global.ScreenWidth === X_WIDTH) ||
    (global.ScreenHeight === X_WIDTH && global.ScreenWidth === X_HEIGHT));

console.log(global.ScreenSizeMod, 'global.ScreenSizeMod');


import RouterConfig from './src/RouterConfig';

/* 为了注释烦人的调试提醒 */
console.ignoredYellowBox = true;//['Remote debugger'];


export default class Main extends React.Component {
  constructor(props) {
    super(props);

    global.ReadAppConstant = props.ReadAppConstant;
    console.log(global.ReadAppConstant, "====ReadAppConstant======");

  }
  render() {

    var FirstRouter = global.ReadAppConstant.FirstRouter || "SearchCategoryList";
    global.searchSubCategoryId=global.ReadAppConstant.map.searchSubCategoryId;
    global.categoryShowBack=global.ReadAppConstant.map.categoryShowBack;
    // FirstRouter="SearchList";

    if (RouterConfig.hasOwnProperty(FirstRouter)) {
      RouterConfig.FirstRouter = RouterConfig[FirstRouter];
    }

    const App = StackNavigator(RouterConfig, {
      navigationOptions: {
        header: null
      }
    });

    return (
      <App />
    )
  }

}
AppRegistry.registerComponent('ReadApp', () => Main);